package com.toycloud.business.dto.results;

import com.toycloud.system.domain.dto.AnalysisDetailDTO;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Data
public class FeedbackAnalysisResult {

    //列表数据
    private List<AnalysisDetailDTO> analysisList = new ArrayList<>();
    //词云数据
    private List<WordCloudData>  wordCloudDataList = new ArrayList<>();
    //标签占比数据
    private LabelPercentageData labelPercentageData;
    //标签占比数据对比模式
    private LabelPercentageDataCompare labelPercentageDataCompare;
    //单标签用户态度趋势
    private List<Tag> trendTagList = new ArrayList<>();
    //标签用户态度对比
    private List<LabelAttitude> labelAttitudeList = new ArrayList<>();
    //产品用户态度对比
    private List<productAttitude> productAttitudeList = new ArrayList<>();
    //产品用户态度趋势数据
    private AttitudeDateTag attitudeDateTag;

    @Data
    public static class Label{
        private Integer id;
        private String label;
    }

    @Accessors(chain = true)
    @Data
    public static class WordCloudData{
        private String cloudId;
        private String cloudName;
        private String slogan;
        private List<CloudDetail> detailList = new ArrayList<>();
    }

    @Data
    public static class CloudDetail{
        private String name;
        private Integer value;
    }

    @Data
    public static class LabelPercentageData{
        private BarDataDetail fullBarData;
        private Map<String, BarDataDetail> attitudeBarData;
    }

    @Data
    public static class LabelPercentageDataCompare{
        private Map<String, BarDataDetail> attitudeBarData;
    }

    @Data
    public static class BarDataDetail {
        private List<String> legend;
        private List<String> labels;
        private List<Series> series;
    }

    @Data
    public static class Series {
        private String name;
        private List<Double> data;
        private List<Long> labelCountData;
    }

    @Data
    public static class Tag {
        private String label;
        private List<Product> productData;
        private Long allCount;
    }

    @Data
    public static class AttitudeDateTag{
        private List<String> date;
        private List<AttitudeTag> attitudeTags;
    }

    @Data
    public static class AttitudeTag{
        private String attitude;
        private List<ProductTrend> productTrends;
    }

    @Data
    public static class ProductTrend{
        private String product;
        private List<Double> percentage; // 百分比字段
        private List<Long> labelCount;
    }

    // Product 数据实体
    @Data
    public static class Product {
        private String label;
        private String attitude;
        private List<Trend> trend;
        private Long allCount;
    }

    // Trend 数据实体
    @Data
    public static class Trend {
        private String date; // 日期字段，可以根据需求改为 LocalDate
        private double percentage; // 百分比字段
        private Long labelCount;
    }

    @Data
    public static class LabelAttitude{
        private String label;
        private List<UserAttitudeData> userAttitudeDataList = new ArrayList<>();
        private Integer allCount;
    }

    @Data
    public static class productAttitude{
        private String attitude;
        private List<AttitudeData> AttitudeData = new ArrayList<>();
    }

    @Data
    public static class AttitudeData{
        private String product;
        private Double percentage;
        private Long labelCount;
    }

    @Data
    public static class UserAttitudeData{
        private String product;
        private String attitude;
        private Integer percentage;
        private Long labelCount;
    }

    @Data
    public static class Pair {
        private String label;
        private Double data;
    }

}
